package com.team.cloudsharing.dao.sharefolder;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.team.cloudsharing.dao.folder.FolderDO;
import com.team.cloudsharing.dao.user.UserDO;

@Entity
@Table(name = "share_folder")
public class ShareFolderDO implements Serializable{

	private static final long serialVersionUID = 1L;

	@Id
	@Column(name = "share_folder_id")
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long shareFolderId;
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "date_share", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
	private Date dateShare = new Date();
	
	@Column(name = "is_share_folder_in_trash", nullable = false)
	private boolean isShareFolderInTrash = false;
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "folder_id", nullable = false)
	private FolderDO folderDO;
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "user_id", nullable = false)
	private UserDO userDO;
	
	@Column(name = "user_folder_name", nullable = false)
	private String userFolderName;
	
	public ShareFolderDO() {
		super();
	}

	public ShareFolderDO(FolderDO folderDO, UserDO userDO, String userFolderName) {
		super();
		this.folderDO = folderDO;
		this.userDO = userDO;
		this.userFolderName = userFolderName;
	}

	public Long getShareFolderId() {
		return shareFolderId;
	}

	public void setShareFolderId(Long shareFolderId) {
		this.shareFolderId = shareFolderId;
	}

	public Date getDateShare() {
		return dateShare;
	}

	public void setDateShare(Date dateShare) {
		this.dateShare = dateShare;
	}

	public boolean isShareFolderInTrash() {
		return isShareFolderInTrash;
	}

	public void setShareFolderInTrash(boolean isShareFolderInTrash) {
		this.isShareFolderInTrash = isShareFolderInTrash;
	}

	public FolderDO getFolderDO() {
		return folderDO;
	}

	public void setFolderDO(FolderDO folderDO) {
		this.folderDO = folderDO;
	}

	public UserDO getUserDO() {
		return userDO;
	}

	public void setUserDO(UserDO userDO) {
		this.userDO = userDO;
	}

	public String getUserFolderName() {
		return userFolderName;
	}

	public void setUserFolderName(String userFolderName) {
		this.userFolderName = userFolderName;
	}

}
